package com.key.win.system.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.key.win.base.model.MybatisID;
import com.key.win.system.enums.SexEnum;
import com.key.win.system.enums.UserTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Set;

@ApiModel("用户实体")
@Data
@TableName("sys_user")
@EqualsAndHashCode(callSuper = true)
public class SysUser extends MybatisID {
    @ApiModelProperty("用户名")
    private String userName;
    @ApiModelProperty("密码")
    private String password;
    @ApiModelProperty("昵称")
    private String nickName;
    @ApiModelProperty("状态：true-启用，false-禁用")
    private Boolean enabled = Boolean.TRUE;
    @ApiModelProperty("性别:[男:0, 女:1],默认：0")
    private SexEnum sex = SexEnum.MALE;
    @ApiModelProperty("手机号码")
    private String phone;
    @ApiModelProperty("用户头像")
    private String headImgUrl;
    @ApiModelProperty("用户类型[普通用户：0,管理员:1]，默认:0")
    private UserTypeEnum type = UserTypeEnum.NORMAL;
    @ApiModelProperty("用户签名")
    private String sign;
    @ApiModelProperty("email")
    private String email;

    @ApiModelProperty("机构Id")
    @TableField(exist = false)
    private String organId;
    @ApiModelProperty("设备Id")
    @TableField(exist = false)
    private String deviceId;
    @ApiModelProperty("角色Id")
    @TableField(exist = false)
    private String roleId;
    @ApiModelProperty("新密码")
    @TableField(exist = false)
    private String newPassword;
    @ApiModelProperty("组Id")
    @TableField(exist = false)
    private String groupId;
    @ApiModelProperty("人员所挂载的机构信息")
    @TableField(exist = false)
    private List<SysOrgan> sysOrganUsers;
    @ApiModelProperty("人员所管理的机构列表")
    @TableField(exist = false)
    private List<SysOrgan> sysUserOrgans;
    @ApiModelProperty("设备列表")
    @TableField(exist = false)
    private List<SysDevice> sysDevices;
    @ApiModelProperty("角色列表")
    @TableField(exist = false)
    private List<SysRole> sysRoles;
    @ApiModelProperty("组列表")
    @TableField(exist = false)
    private List<SysGroup> sysGroups;
    @ApiModelProperty("用户Id集合")
    @TableField(exist = false)
    private Set<String> userIds;
    @ApiModelProperty("机构Id集合")
    @TableField(exist = false)
    private Set<String> organIds;
    @ApiModelProperty("sysUserDevices")
    @TableField(exist = false)
    private List<SysUserDevice> sysUserDevices;

    @ApiModelProperty("sysOrganUserList")
    @TableField(exist = false)
    private  List<SysOrganUser> sysOrganUserList;


    @ApiModelProperty("在否在线：true-在线，false-下线")
    @TableField(exist = false)
    private boolean isOnLine;

    @ApiModelProperty("token")
    @TableField(exist = false)
    private String token;

    @ApiModelProperty("refreshToken")
    @TableField(exist = false)
    private String refreshToken;


    public String getAvatar() {
        return this.headImgUrl;
    }

}
